package lion.framework.core.db.paging;

import lion.framework.core.db.anno.SQLPaging;

/**
 * 普用分页 数据库分页 行数从1开始记<br/>
 * <code>limit size offset start<code>
 * <pre>
 * time   2013 2013-4-24 上午11:28:57
 * mail   hl_0074@sina.com
 * </pre>
 * 
 * @author lion
 */
@SQLPaging({ "postgresql", "sqlite", "h2db" })
public class PostgreSQLPaging implements ISQLPaging {

	@Override
	public String paging(String sql, int start, int size) {

		if (size < 0) { return sql; }
		start = start - 1;
		if (start <= 0) {
			start = 0;
		}

		return sql + " limit " + start + "offset " + size;
	}
}
